<div class="layui-card-body ">
    <form id="layer-form" style="margin-top: 15px;" class="layui-form" action="{{route('admin.basic.examcreate')}}">
        @csrf
        <div class="layui-form-item">
            <label class="layui-form-label">名称</label>
            <div class="layui-input-block">
                <input type="text" name="name" autocomplete="off" value=""  placeholder="请输入考试批次名称"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">考试时间</label>
            <div class="layui-input-inline">
                <input type="hidden" name="basic_id"  value="{{request('basic_id')}}">
                <input type="text" name="exam_start_at" autocomplete="off" value="" id="exam_start_at" placeholder="请选择考试开始时间"
                       class="layui-input">
            </div>
            <div class="layui-form-mid">-</div>
            <div class="layui-input-inline">
                <input type="text" name="exam_end_at" id="exam_end_at" autocomplete="off" value="" placeholder="请选择考试结束时间"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">开考密码</label>
            <div class="layui-input-inline">
                <input type="text" name="password" id="password" autocomplete="off" value="" placeholder="请点击生成考试密码"
                       class="layui-input">
            </div>
            <div class="layui-word-aux"><button type="button" class="layui-btn layui-btn-primary" onclick="createPassword()">生成密码</button></div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">考试地址</label>
            <div class="layui-input-block">
                <input type="text" name="address"  autocomplete="off" value="" placeholder="请输入考试地址"
                       class="layui-input">
            </div>
        </div>
        <div class="layui-form-item">
            <label class="layui-form-label">备注</label>
            <div class="layui-input-block">
                <textarea class="layui-textarea" name="description" rows="3" placeholder="备注"></textarea>
            </div>
        </div>
    </form>
</div>

<script>
    var idx = -1;
    function createPassword(){
        var password = Math.random().toFixed(6).slice(-6);
        $("#password").val(password)
    }
    layui.use(['laydate'], function () {
        var laydate = layui.laydate;
        laydate.render({
            elem: '#exam_start_at'
            ,type: 'datetime'
        });
        laydate.render({
            elem: '#exam_end_at'
            ,type: 'datetime'
        });
    });
</script>
